<?php

/*
 * EachGo电商网站 新媒体
 * www.eachgo.cn
 */

namespace Home\Model;

/**
 * StoreHouseModel
 * 请输入描述
 * @author Moon
 */
use Think\Model;

class StoreHouseModel extends Model {
    /*
     * 增加一条记录
     */

    public function addStoreHouse($obj) {
        $res = $this->add($obj);
        return $res;
    }

    /*
     * 删除一条记录
     */

    public function deleteStoreHouse($obj) {
        $res = $this->where('ID = "' . $obj['ID'] . '"')->delete();
        return $res;
    }

    /*
     * 更新一条记录
     */

    public function updateStoreHouse($obj) {
        $res = $this->where('ID = "' . $obj['ID'] . '"')->save($obj);
        return $res;
    }

    /*
     * 查询记录 by 时间
     */

    public function selectStoreHouseByBrandTypeId($obj) {
        $res = $this->where('brand_Type_ID = "' . $obj['brand_Type_ID'] . '"')->select();
        return $res;
    }

    /*
     * 查询记录 by 内容
     */

    public function selectStoreHouseByUnitPrice($obj) {
        $res = $this->where('purchase_Unit_Price between "' . $obj['Down_Price'] . ' and  ' . $obj['Top_Price'] . '"')->select();
        return $res;
    }

    /*
     * 查询记录 by 时间
     */

    public function selectStoreHouseByGoodTypeId($obj) {
        $res = $this->where('goods_Type_ID = "' . $obj['goods_Type_ID'] . '"')->select();
        return $res;
    }

    /*
     * 查询记录 by 时间
     */

    public function selectStoreHouseById($obj) {
        $res = $this->where('ID = "' . $obj['ID'] . '"')->select();
        return $res;
    }

}
